<template>
	<view class="shopList_box" :style="style_item">
		<view v-for="(item,index) in list" :key="index" class="shopList_item">
			<view @click="toGood(item)" class="iten_box">
				<!-- <mImg  
					mode="aspectFit" 
					border-radius="0" 
					:fade="true" 
					duration="450"
					width="30vw" 
					height="30vw" 
					:src="item.pic" 
					:lazy-load="true"
				></mImg> -->
				<kuang v-if="item.template_id>0" :item="chagne_item(item)" :src="to_pic(item.pic)"></kuang>
				<u-image v-else mode="aspectFit" border-radius="0" :fade="true" duration="450" width="30vw" height="30vw" :src="to_pic(item.pic)" :lazy-load="true"></u-image>
				
				<view class="shopList_item_name">
					<view class="shop_name uni-ellipsis-2">
						{{item.name}}
					</view>
					<view :style="{color:style.color3}" class="good_price">
						RMB ¥{{item.price}}
					</view>
					<!-- <view class="good_price_RMB">
						≈{{item.cny_price}}RMB
					</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import mImg from '@/componts/m-img/index.vue';
	import kuang from '@/componts/index_comp/kuang.vue';
	export default {
		components: {
			mImg,
			kuang
		},
		props: {
			// 缺省图
			list: {
				type: Array,
				default: []
			},
			style_item: {
				type: Object,
				default: () => ({
					
				})
			},

		},
		data() {
			return {
				style:{}
			}
		},
		mounted() {
			var style =  uni.getStorageSync('style')
			style = JSON.parse(style)
			this.style = style
		},
		methods: {
			chagne_item(item) {
				 var cc = JSON.parse(JSON.stringify(item))
				if (cc.template_id) {
					cc.template_style.content = JSON.parse(cc.template_style.content)
				} else {
					cc.template = {
						baoZhuang: "",
						shop_name: "",
						sku: "",
						title: "",
						title2: "",
						title3: "",
						type: "",
					}
					
				}
				return cc
			},
			toGood(item) {
				uni.navigateTo({
					url: '/pages/shop_info/shop_info?id=' + item.id
				})
			},
			to_pic(url) {
				var pic = url.split(",")
				return pic[0]
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import url(./shopList.css);
</style>